<?php 
require('./lib/init.php');
//检测是否登录,有操作权限
tiao();

//获取要删除的评论id
$comment_id = $_GET['comment_id'];
//
$del = "delete from comment where comment_id = '$comment_id'";
//获取当前评论的art_id
$sql = "select art_id from comment where comment_id = '$comment_id'";
$art_id = mGetOne($sql);
//做判断
if(!mQuery($del)){
	error('评论删除失败');
}else{
	//将art表的comm数量-1
	$sql = "update art set comm = comm-1 where art_id = '$art_id'";
	mQuery($sql);
	//跳回上个页面
	$ref = $_SERVER['HTTP_REFERER'];
	header("Location:$ref");
}


 ?>